<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>借贷管理系统</title>
    <meta name="keywords" content="借贷管理系统">
    <meta name="description" content="借贷管理系统">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="__PUBLIC__/admin/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">

    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">


    <!--<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/plugins/webuploader/webuploader.css">-->
    <!--<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/demo/webuploader-demo.css">-->
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>

    <script src="__PUBLIC__/admin/js/plugins/summernote/summernote.min.js"></script>
    <script src="__PUBLIC__/admin/js/plugins/summernote/summernote-zh-CN.js"></script>


    <!--<script src="__PUBLIC__/admin/js/plugins/webuploader/webuploader.min.js"></script>-->

    <!--<script src="__PUBLIC__/admin/js/demo/webuploader-demo.js"></script>-->
    <!--&lt;!&ndash;<script src="__PUBLIC__/admin/js/demo/webuploader_file.js"></script>&ndash;&gt;-->

</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加免息规则</h5>
                </div>
                <div class="ibox-content" style="overflow: hidden">
                    <form role="form" class="form-horizontal" id="form1" action="__APP__/admin/index/addregular" method="post" enctype="multipart/form-data">

                        <div class="col-md-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">免息规则：</label>
                                <div class="col-sm-4">
                                    <input type="text" id="regular" name="regular" class="form-control" placeholder="请输入免息规则"  >

                                </div>
                            </div>

                            <div class="col-sm-12 col-sm-offset-3">
                                <button class="btn btn-primary" type="button" id="" onclick="return tijiao();">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<style>
    .modal-backdrop {
        z-index: 1 !important;
    }
</style>



<script>
    //    $(document).ready(function() {
    //        $('#summernote').summernote();
    //    });
    //$('#summernote').code(); 获取编辑器内容
    $(document).ready(function() {
//      $("#uploader").powerWebUpload({ hiddenInputId: "uploadhidden" });
        $('#summernote').summernote({
            lang: 'zh-CN', // default: 'en-US'
            height: 500,
            onImageUpload: function(files, editor, welEditable) {
                sendFile(files[0],editor,welEditable);
            }
        });
    });

    function sendFile(file,editor,welEditable) {
        data = new FormData();
        data.append("file", file);
        $.ajax({
            data: data,
            type: "POST",
            url: "/index.php/admin/Tool/ajax_upload",
            cache: false,
            contentType: false,
            processData: false,
            dataType:'json',
            success: function(data) {
                editor.insertImage(welEditable, data.name);
            }
        });
    }

    function tijiao() {
        var regular=document.getElementById("regular").value;
        if(regular=="")
        {
            alert("免息规则不能为空！");
            document.getElementById("regular").focus();
            return false;
        }
        $("#hidval").val($('#summernote').code() );
        // alert($("#uploadhidden").val());
        var ss= $("#hidval").val();
        $('#form1').submit();
    }

</script>
<link href="__PUBLIC__/js/jquery.uploadify-v2.1.4/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.uploadify-v2.1.4/swfobject.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery.uploadify-v2.1.4/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#uploadify").uploadify({
            'uploader': '__PUBLIC__/js/jquery.uploadify-v2.1.4/uploadify.swf', //uploadify.swf文件的路径
            'script': '/index.php/admin/Tool/ajax_upload', //处理文件上传的后台脚本的路径
            'cancelImg': '__PUBLIC__/js/jquery.uploadify-v2.1.4/cancel.png',
            //  'folder': 'UploadFile/<% = subpathName %>', //上传文件夹的路径
            'queueID': 'fileQueue', //页面中，你想要用来作为文件队列的元素的id
            'auto': true, //当文件被添加到队列时，自动上传
            'multi': true, //设置为true将允许多文件上传
            'fileExt': '*.jpg;*.gif;*.png', //允许上传的文件后缀
            'fileDesc': 'Web Image Files (.JPG, .GIF, .PNG)', //在浏览窗口底部的文件类型下拉菜单中显示的文本
            'sizeLimit': 1024*1000,  //上传文件的大小限制，单位为字节 100k
            'onCancel': function (event, ID, fileObj, data) { //当从上传队列每移除一个文件时触发一次
                //  alert('The upload of ' + fileObj.name + ' has been canceled!');
            },
            'onComplete': function (event, ID, fileObj, response, data) { //每完成一次文件上传时触发一次

                var result=eval('['+response+']');
                // $("#fileQueue").append('<img src="'+result[0].name+'" style="width：50px;height:50px;margin-right: 10px">');
                console.log(result)
                $("#comimg").attr( 'src',result[0].name)
                $('#uploadhidden').val(result[0].name);
            },
            'onAllComplete': function (event, data) { //当上传队列中的所有文件都完成上传时触发

            }
        });
    });
</script>

</body>

</html>



